package com.foosun.entity.wechat;

public enum OperCode {
	CONVERSATION_NOT_CONNECTED ("1000", "创建未接入会话"),
	CONVERSATION_CONNECTED ("1001", "接入会话"), 
	INITIATE_CONVERSATION ("1002", "主动发起会话"),
	TRANSFER_CUSTOMER ("1003", "切换客服"),
	CONVERSATION_CLOSED ("1004", "关闭会话"),
	GRAB_CONVERSATION ("1005", "抢接会话"),
	INTERNAL_CODE ("1006", "内部编码"),
	PLATFORM_RECIEVED_MESSAGE ("2001", "公众号收到消息"),
	PLATFORM_SENT_MESSAGE ("2002", "客服发送消息"),
	CS_RECIEVED_MESSAGE ("2003", "客服收到消息");
	
	private String code;
	private String displayName;
	
	private OperCode(String code, String displayName) {
		this.code = code;
		this.displayName = displayName;
	}

	public String getCode() {
		return this.code;
	}
	
	public String getDisplayName() {
		return this.displayName;
	}
	
	
	public static OperCode decode(String code) {
		OperCode[] operCodes = OperCode.values();
		for (OperCode operCode : operCodes) {
			if(operCode.getCode().equals(code)) {
				return operCode;
			}
		}
		return null;
	}
	
	public static void main(String[] args){
		System.out.println(OperCode.valueOf("CONVERSATION_NOT_CONNECTED").displayName);
	}
}
